﻿using PRO.Admin;
using PRO.Config;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace web.Manage.setting
{
    public partial class _default : ManageBase
    {
        
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BaseConfigInfo config = BaseConfigs.GetBaseConfig();
                this.txtTitle.Text = config.Title;
                this.txtKeywords.Text = config.Keywords;
                this.txtDes.Text = config.Description;
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            BaseConfigInfo config = BaseConfigs.GetBaseConfig();
            config.Title = this.txtTitle.Text;
            config.Keywords = this.txtKeywords.Text;
            config.Description = this.txtDes.Text;
            if (BaseConfigs.SaveConfig(config))
            {
                BaseConfigs.ResetConfig();
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('修改成功！');</script>");
            }
            else
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('修改失败！');</script>");
        }
    }
}